package com.example.demo.springbootdemo.controller;

import com.example.demo.springbootdemo.model.MessageInfo;
import com.example.demo.springbootdemo.service.MessageInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;
import java.util.List;

@RestController
@RequestMapping("/messageWall")
public class MessageWallController {
//    private List<MessageInfo> list = new LinkedList<>();

    @Autowired
    private MessageInfoService messageInfoService;

    @RequestMapping("/submit")
    public Boolean save(@RequestBody MessageInfo info) {
        return messageInfoService.insertMessageInfo(info);
    }

    @RequestMapping("/getMessageWallList")
    public List<MessageInfo> getList() {
        return messageInfoService.queryMessageInfos();
    }
}
